/**
 * @description: 请求间隔
 */
export enum RequestHttpIntervalEnum {
    // 秒
    SECOND = 'second',
    // 分
    MINUTE = 'minute',
    // 时
    HOUR = 'hour',
    // 天
    DAY = 'day'
}

/**
 * @description: 请求参数类型
 */
export enum RequestParamsTypeEnum {
    PARAMS = 'Params',
    BODY = 'Body',
    HEADER = 'Header',
}
/**
 * @description: 请求头部类型
 */
export enum RequestBodyEnum {
    NONE = 'none',
    FORM_DATA = 'form-data',
    X_WWW_FORM_URLENCODED = 'x-www-form-urlencoded',
    JSON = 'json',
    XML = 'xml'
}
/**
 * @description: 请求参数主体
 */
export type RequestParamsObjType = {
    [T: string]: string
}
export type RequestParams = {
    [RequestParamsTypeEnum.PARAMS]: RequestParamsObjType
    [RequestParamsTypeEnum.HEADER]: RequestParamsObjType
    [RequestParamsTypeEnum.BODY]: {
        [RequestBodyEnum.FORM_DATA]: RequestParamsObjType
        [RequestBodyEnum.X_WWW_FORM_URLENCODED]: RequestParamsObjType
        [RequestBodyEnum.JSON]: string
        [RequestBodyEnum.XML]: string
    }
}

// 数据相关
export enum RequestDataTypeEnum {
    // 静态数据
    STATIC = 0,
    // 请求数据
    AJAX = 1,
    // 数据池
    Pond = 2
}

// 请求方法
export enum RequestHttpEnum {
    GET = 'get',
    POST = 'post',
    PATCH = 'patch',
    PUT = 'put',
    DELETE = 'delete'
}

// 请求主体类型
export enum RequestContentTypeEnum {
    // 普通请求
    DEFAULT = 0,
    // SQL请求
    SQL = 1
}

// 头部
export enum RequestHttpHeaderEnum {
    TOKEN = 'Token',
    COOKIE = 'Cookie'
}

/**
 * @description: 请求间隔名称
 */
export const SelectHttpTimeNameObj = {
  [RequestHttpIntervalEnum.SECOND]: '秒',
  [RequestHttpIntervalEnum.MINUTE]: '分',
  [RequestHttpIntervalEnum.HOUR]: '时',
  [RequestHttpIntervalEnum.DAY]: '天'
}


/**
 * @description: 请求头部类型数组
 */
export const RequestBodyEnumList = [
  RequestBodyEnum.NONE,
  RequestBodyEnum.FORM_DATA,
  RequestBodyEnum.X_WWW_FORM_URLENCODED,
  RequestBodyEnum.JSON,
  RequestBodyEnum.XML
]
// ajax 请求类型
export interface SelectHttpType {
  label: RequestHttpEnum
  value: RequestHttpEnum
  disabled?: boolean
  style?: object
}

// 类型选项
export const selectTypeOptions: SelectHttpType[] = [
  {
    label: RequestHttpEnum.GET,
    value: RequestHttpEnum.GET,
    style: {
      color: 'greenyellow',
      fontWeight: 'bold'
    }
  },
  {
    label: RequestHttpEnum.POST,
    value: RequestHttpEnum.POST,
    style: {
      color: 'skyblue',
      fontWeight: 'bold'
    }
  },
  {
    label: RequestHttpEnum.PUT,
    value: RequestHttpEnum.PUT,
    style: {
      color: 'goldenrod',
      fontWeight: 'bold'
    }
  },
  {
    label: RequestHttpEnum.PATCH,
    value: RequestHttpEnum.PATCH,
    style: {
      color: 'violet',
      fontWeight: 'bold'
    }
  },
  {
    label: RequestHttpEnum.DELETE,
    value: RequestHttpEnum.DELETE,
    disabled: true,
    style: {
      fontWeight: 'bold'
    }
  },
]


// 常用的contentTyp类型
export enum ContentTypeEnum {
  // json
  JSON = 'application/json;charset=UTF-8',
  // text
  TEXT = 'text/plain;charset=UTF-8',
  // xml
  XML = 'application/xml;charset=UTF-8',
  // application/x-www-form-urlencoded 一般配合qs
  FORM_URLENCODED = 'application/x-www-form-urlencoded;charset=UTF-8',
  // form-data  上传
  FORM_DATA = 'multipart/form-data;charset=UTF-8'
}